package com.yb.oldlearning;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;

/**
 * 休眠
 * @author Administrator
 */
public class SleepingTask extends LiftOff{
	public void run(){
		try {
			while(countDown-- >0){
				System.out.println(status());
				TimeUnit.MILLISECONDS.sleep(1000);//设置成1000个时间单位效果比较明显
			}
		} catch (InterruptedException e) {
			System.err.println("Interrupted");
		}
	}
	public static void main(String[] args) {
		ExecutorService executorService = Executors.newCachedThreadPool();
		for (int i = 0; i < 3; i++) {
			executorService.execute(new SleepingTask());
		}
		executorService.shutdown();
	}
}
